﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.CodeDom.Compiler;

namespace Refl.Dreaming
{
    /// <summary>
    /// Standard class for indicating a error in a Dream.
    /// </summary>
    public class DreamError
    {
        /// <summary>
        /// Gets or Sets a Boolean value indicating wheter or not the error is a compilation error.
        /// </summary>
        public Triple IsCompilerError;
        /// <summary>
        /// Gets or Sets the error code, in the form [Type]:[Method].[(Optional)Subroutine]/[Issue]
        /// </summary>
        public string Code;
        /// <summary>
        /// Gets or Sets the error message associated with the code.
        /// </summary>
        public string Message;
        /// <summary>
        /// Gets an Exception which represents this DreamError instance. Useful if this error indicates fatality.
        /// </summary>
        public Exception Exception
        {
            get
            {
                return new Exception(Code + "=> " + Message);
            }
        }
        //TODO: replace int? with big integer
        public int? Line;
        public int? Column;
        public DreamError()
        {
        }
        public DreamError(string Code, string Message, int? Line, int? Column, Triple IsCompilerError)
        {
            this.Code = Code;
            this.Message = Message;
            this.Line = Line;
            this.Column = Column;
            this.IsCompilerError = IsCompilerError;
        }
    }
}
